<?php

namespace app\admin\validate;

use think\Validate;

class AdminValidate extends Validate
{
    // 定义验证规则
    protected $rule = [
        'username'  => 'require|alphaDash|length:5,20',
        'password'  => 'require|length:5,20',
        'captcha'   => 'require',
        'nickname'  => 'require',
        'userqq'    => 'require',
        'oldpwd'    => 'require',
        'newpwd'    => 'require',

    ];
    // 定义验证提示
    protected $message = [
        'username.require'   => '用户名不能为空！',
        'username.length'     => '密码长度6-20位！',
        'password.require'    => '密码不能为空！',
        'password.alphaDash' => '密码格式不正确！',
        'password.length'     => '密码长度6-20位！',
        'captcha.require'      => '验证码不能为空！',
    ];
    //定义验证场景
    protected $scene = [
        'login'  =>  ['username','password','captcha'],
        'admininfo'  =>  ['username','nickname','userqq'],
        'pwd'  =>  ['oldpwd','newpwd'],
    ];


}